﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VkApi.DataTypes
{
    /// <summary>
    /// Class that represents response.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class Response<T>
    {
        /// <summary>
        /// Gets or sets the response ID.
        /// </summary>
        /// <value>The response ID.</value>
        public long ResponseID { get; protected set; }

        /// <summary>
        /// Gets or sets the response data.
        /// </summary>
        /// <value>The response data.</value>
        public T ResponseData { get; protected set; }

        /// <summary>
        /// Gets or sets the raw json response.
        /// </summary>
        /// <value>The raw json.</value>
        public string RawJson { get; protected set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is error.
        /// </summary>
        /// <value><c>true</c> if this instance is error; otherwise, <c>false</c>.</value>
        public bool IsError { get; protected set; }
        /// <summary>
        /// Gets or sets the error.
        /// </summary>
        /// <value>The error.</value>
        public ErrorData Error { get; protected set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="Response&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="responseID">The response ID.</param>
        /// <param name="responseData">The response data.</param>
        /// <param name="rawJson">The raw json response.</param>
        public Response(long responseID, T responseData, string rawJson)
        {
            this.ResponseID = responseID;
            this.ResponseData = responseData;
            this.RawJson = rawJson;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Response&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="responseID">The response ID.</param>
        /// <param name="error">The error.</param>
        /// <param name="rawJson">The raw json.</param>
        public Response(long responseID, ErrorData error, string rawJson)
        {
            this.ResponseID = responseID;
            this.IsError = true;
            this.Error = error;
            this.RawJson = rawJson;
        }
    }
}
